{% extends 'annotating_data/base.html' %}
{% block content %}
    <section class="shop section">
        <div class="container">
            <div class="row">

                <!--任务中的数据-列表-->
                <div class="col-lg-12 mx-auto">
                    <div class="account-content">
                        <div class="d-flex justify-content-between mb-3">
                            <h4 class="account-content-title"><i class="far fa-map-marker-alt"></i>
                                [ {{ task.task_name }} ]任务数据</h4>
                            <a href="#" class="profile-btn" id="submit_task">提交任务</a>
                        </div>
                        <script>
                            //监听“提交任务”事件，并弹出确认窗口
                            // 获取点击目标元素
                            const targetElement = document.getElementById("submit_task");

                            // 添加点击事件监听器
                            targetElement.addEventListener('click', function () {
                                // 弹出提示窗口
                                alert('确定提交任务吗？');
                            });

                        </script>
                        <div class="account-content-table">
                            <div class="table-responsive">
                                <table class="table table-borderless">
                                    <tr>
                                        <th>数据ID</th>
                                        <th>内容</th>
                                        <th>状态</th>
                                        <th>标注</th>
                                    </tr>
                                    {% for data in taskdatas %}
                                        <tr class="account-order-list">
                                            <td><b>{{ data.taskdata_id }}</b></td>
{#                                        {{ data.taskdata_content }}#}
                                            {% if task.task_type == '1' or task.task_type == '2' or task.task_type == '3' %}
                                            <td>{{ data.taskdata_content|truncatechars:50 }}</td>
                                            {% elif task.task_type == '5' or task.task_type == '4' %}
                                            <td><img src="/images/{{ data.taskdata_content }}" width="60" height="10"></td>
                                            {% endif %}
                                            <td>
                                                {% if data.taskdata_result.label or data.taskdata_result.result %}<span class="badge bg-success">已标注</span>
                                                 {% else %}   <span class="badge bg-danger">未标注</span>
                                                {% endif %}
                                            </td>

                                            <td>

                                                <a href="{% url 'annotating_data:annotate' task.id data.taskdata_id %}"
                                                   class="content-action content-action-mr"><i
                                                        class="far fa-pen"></i></a>

                                            </td>
                                        </tr>

                                    {% endfor %}
                                </table>
                            </div>
                            <div class="col-12">

                                <div class="pagination center mt-2">
                                    <ul class="pagination-list">
                                        <li><a href="#"><i class="ti-arrow-left"></i></a></li>
                                        <li class="active" ><a href="#">1</a></li>
                                        <li ><a href="#">2</a></li>
                                        <li><a href="#">3</a></li>
                                        <li><a href="#"><i class="ti-arrow-right"></i></a></li>
                                    </ul>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
{% endblock %}
